
<template>
   <div>
      <button @click="store.increment()">{{ store.num }}</button>
      <button @click="store.$patch({num:100})">100</button>
      <button @click="store.num++">+1</button>
      <p>double:{{ store.dobuleNum }}</p>
   </div>
</template>
<script setup>
// 导入
import {useCounter} from '../stores/counter';
// 创建仓库的实例
const store = useCounter();
// 监听store动作
// store.$onAction(obj => {
//    console.log("动作被执行",obj);
// })
// 监听store状态
store.$subscribe(state => {
   console.log("状态被修改",state);
})
 

</script>
